# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=knock
pkgver=105.9970299
pkgrel=2
epoch=2
groups=('blackarch' 'blackarch-scanner' 'blackarch-recon')
pkgdesc='Subdomain scanner.'
arch=('any')
url='https://github.com/guelfoweb/knock'
license=('GPL3')
depends=('python' 'python-dnspython' 'python-colorama' 'python-beautifulsoup4'
         'python-requests' 'python-networkx' 'python-matplotlib')
makedepends=('git' 'python-setuptools')
source=("git+https://github.com/guelfoweb/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  python setup.py build
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/README.md" README.md

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/knockpy" "$pkgdir/usr/bin/$pkgname"
}

